/*
 ============================================================================
 Name		: CamEngine.h
 Author	  : Lenka Litvova
 Version	 : 1.0
 Copyright   : Copyright belongs to Lenka Litvova
 Description : CCamEngine declaration
 ============================================================================
 */

#ifndef CAMENGINE_H
#define CAMENGINE_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib
#include <caeengine.h>

#include "CameraReceiver.h"

//#include "FRamIContainer2.H"

class CFRamI_UIAppUi;

// CLASS DECLARATION

/**
*  CCamEngine
* 
*/

class CCamEngine : public CBase ,public MCamAppEngineObserver

{
public: // Constructors and destructor

	/**
        * Destructor.
        */
	~CCamEngine();

        /**
        * Two-phased constructor.
        */
	//static CCamEngine* NewL(CFRamIContainer2& aView,const TRect& aRect);
	static CCamEngine* NewL(MCameraReceiver *aReceiver, CFRamI_UIAppUi *aAppUi);

        /**
        * Two-phased constructor.
        */
	//static CCamEngine* NewLC(CFRamIContainer2& aView,const TRect& aRect);
	static CCamEngine* NewLC(MCameraReceiver *aReceiver, CFRamI_UIAppUi *aAppUi);
	
public:	//methods from MCamAppEngineObserver
	void  McaeoInitComplete (TInt aError);
	void  McaeoStillPrepareComplete (TInt aError);
	void  McaeoVideoPrepareComplete (TInt aError);
	void  McaeoViewFinderFrameReady (CFbsBitmap &aFrame, TInt aError);
	void  McaeoSnapImageReady (const CFbsBitmap &aBitmap, TInt aError);
	void  McaeoStillImageReady (CFbsBitmap *aBitmap, HBufC8 *aData, TInt aError);
	void  McaeoVideoRecordingOn (TInt aError);
	void  McaeoVideoRecordingPaused (TInt aError);
	void  McaeoVideoRecordingComplete (TInt aError);
	void  McaeoVideoRecordingTimes (TTimeIntervalMicroSeconds aTimeElapsed, TTimeIntervalMicroSeconds aTimeRemaining, TInt aError);
	 
public:
	/**
	 * Initialise the camera for still image capture. Viewfinder is not started.
	 */ 
	void InitCameraL();
	/**
	  * Initialise the camera for still image capture. Viewfinder is also started.
	  */ 
	void InitCameraL(TSize aViewSize);
	/**
	 * Capture single still image.
	 */ 
	void CaptureImage();
	/**
	 * Stops the viewfinder.
	 */ 
	void StopViewFinderL();
	
private:
	/**
	 * Starts the viewfinder.
	 */ 
	void StartViewFinderL();
	
private:
	/**
      * Constructor for performing 1st stage construction
      */
	//CCamEngine(CFRamIContainer2& aView,const TRect& aRect);
	CCamEngine(MCameraReceiver *aView, CFRamI_UIAppUi *aAppUi);
	
	/**
        * EPOC default constructor for performing 2nd stage construction
        */
	void ConstructL();

private:
	//data members
	CCaeEngine* iCaeEngine;
	MCameraReceiver *iContainer;
	//TRect iViewRect;
	//RFile iFile;
	//TBuf<10> errBuf;
	TSize iViewSize;
	TBool iViewfinderMode;
	
	CFRamI_UIAppUi* iAppUi;
	
	TBool iCapture;
};


#endif // CAMENGINE_H
